package com.bnz.bnzshop.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bnz.bnzshop.dao.ItemCatDao;
import com.bnz.bnzshop.entity.ItemCatEntity;
import com.bnz.bnzshop.service.ItemCatService;
import com.bnz.common.utils.PageUtils;
import com.bnz.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("itemCatService")
public class ItemCatServiceImpl extends ServiceImpl<ItemCatDao,ItemCatEntity> implements ItemCatService {
    @Autowired
    private ItemCatDao itemCatDao;
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ItemCatEntity> page = this.page(
                new Query<ItemCatEntity>().getPage(params),
                new QueryWrapper<ItemCatEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<ItemCatEntity> getByPid(String parentId) {

        return itemCatDao.selectList(new QueryWrapper<ItemCatEntity>().eq("parent_id",parentId));
    }
}